package LC24;

/**
 * @author zhangsan
 */
public class LC2390 {

    public static void main(String[] args) {
        System.out.println(removeStars("leet**cod*e"));
    }

    public static String removeStars(String s) {
        int length = s.length();
        StringBuilder str = new StringBuilder();
        for (int i = 0; i < length; i++) {
            char c = s.charAt(i);
            if (c == '*') {
                str.deleteCharAt(str.length() - 1);
            } else {
                str.append(c);
            }
        }
        return str.toString();
    }
}
